home *** CD-ROM | disk | FTP | other *** search
Wrap
; ----------------------------------------------------- ; Peace and Protection (by misspai) ; ----------------------------------------------------- ; Main (normal) aliases ; (Fourth section) ; ----------------------------------------------------- ; ICMP/etc. detection ; ----------------------------------------------------- netstat if (3.1 isin $os) _error Sorry, the attack detectors do not work properly on Windows 3.11 | dispa Detecting attack statistics... | run -n $_ppdir $+ do-ns.bat $ddename $_ppdir /_nsdone -s icmp netstat _nsdone { set %.file $_ppdir $+ ns-temp.txt if ($lines(%.file) < 55) _error Error running NETSTAT.EXE! set %.vars frag1.frag2.frag3.frag4.frag5.frag6.nuke1.nuke2.nuke3.nuke4.nuke5.echo1.echo2.echo3.echo4.echo5.echo6.udp1.udp2.udp3.udp4 set %.lines 15.16.17.18.19.20.27.28.29.30.31.32.33.34.35.36.37.52.53.54.55 set %.toks 4.4.4.5.5.4.3.3.3.3.2.2.4.2.4.3.5.4.4.4.4 set %.num 22 :loop set %.get $read -nl [ $+ [ $gettok(%.lines,%.num,46) ] ] %.file set %.ns. [ $+ [ $gettok(%.vars,%.num,46) ] ] $gettok(%.get,$gettok(%.toks,%.num,46),32) if ($_vd(.num) > 0) goto loop window -c @Attack window -l $_tabscale(5,9) @Attack $_winpos(35%,35%,5%,5%) @Close %font.basic titlebar @Attack detection - Nuke, ICMP, UDP Flood, SSPing aline @Attack Nuke detect - %col.target $+ $calc(%.ns.nuke1 + %.ns.nuke2 + %.ns.nuke3 + %.ns.nuke4 + %.ns.nuke5) $+ unreach/error packets aline @Attack ICMP detect - %col.target $+ $calc(%.ns.echo1 + %.ns.echo3 + %.ns.echo5) $+ echos received, %col.target $+ $calc(%.ns.echo2 + %.ns.echo4 + %.ns.echo6) $+ replied to aline @Attack UDP detect - %col.target $+ %.ns.udp1 $+ datagrams received, %col.target $+ %.ns.udp4 $+ sent, %col.target $+ $calc(%.ns.udp2 + %.ns.udp3) $+ errors aline @Attack SSPing detect - %col.target $+ $calc(%.ns.frag1 + %.ns.frag2 + %.ns.frag3 + %.ns.frag4 + %.ns.frag5 + %.ns.frag6) $+ fragmented packets } detect if (3.1 isin $os) _error Sorry, the attack detectors do not work properly on Windows 3.11 | unset %_detect.* %_dwarn.* | if ($1 == $null) set %_detect.sec 5 | else set %_detect.sec $1 | if ($2 == $null) set %_detect.max 5 | else set %_detect.max $2 | if ($3 == $null) set %_detect.sens 2 | else set %_detect.sens $3 | set %.delay $calc(%_detect.sec * 1000) | run -n $_ppdir $+ loop-ns.bat $ddename $_ppdir /_nsloop %.delay -s _nsloop { set %.file $_ppdir $+ ns-temp.txt if ($lines(%.file) < 55) _error Error running NETSTAT.EXE! set %.vars frag1.frag2.frag3.frag4.frag5.frag6.nuke1.nuke2.nuke3.nuke4.nuke5.echo1.echo2.echo3.echo4.echo5.echo6.udp1.udp2.udp3.udp4 set %.lines 15.16.17.18.19.20.27.28.29.30.31.32.33.34.35.36.37.52.53.54.55 set %.toks 4.4.4.5.5.4.3.3.3.3.2.2.4.2.4.3.5.4.4.4.4 set %.num 21 :loop set %.get $read -nl [ $+ [ $gettok(%.lines,%.num,46) ] ] %.file set %.ns. [ $+ [ $gettok(%.vars,%.num,46) ] ] $gettok(%.get,$gettok(%.toks,%.num,46),32) if ($_vd(.num) > 0) goto loop if ($window(@Attack) == $null) { window -l $_tabscale(5,9) @Attack $_winpos(35%,35%,5%,5%) @Close %font.basic titlebar @Attack detection - Nuke, ICMP, UDP Flood, SSPing } set %.unreach $calc(%.ns.nuke1 + %.ns.nuke2 + %.ns.nuke3 + %.ns.nuke4 + %.ns.nuke5) set %.echo1 $calc(%.ns.echo1 + %.ns.echo3 + %.ns.echo5) set %.echo2 $calc(%.ns.echo2 + %.ns.echo4 + %.ns.echo6) set %.udperr $calc(%.ns.udp2 + %.ns.udp3) set %.gibs $calc(%.ns.frag1 + %.ns.frag2 + %.ns.frag3 + %.ns.frag4 + %.ns.frag5 + %.ns.frag6) set %.max $calc(%_detect.sec * %_detect.max) set %.col.ok $remove(%col.target,) $+ set %.col.warn $remove(%col.att,) $+ if (%_detect.n == $null) { set %_detect.n %.unreach set %_detect.i1 %.echo1 set %_detect.i2 %.echo2 set %_detect.u1 %.ns.udp1 set %_detect.u2 %.ns.udp4 set %_detect.u3 %.udperr set %_detect.g %.gibs } unset %.warn %.swt if ($calc(%.ns.udp1 - %_detect.u1) > %.max) { set %.col.u1 %.col.warn | set %.swt -h } else set %.col.u1 %.col.ok if ($calc(%.ns.udp4 - %_detect.u2) > %.max) { set %.col.u2 %.col.warn | set %.swt -h } else set %.col.u2 %.col.ok if ($calc(%.udperr - %_detect.u3) > %.max) { inc %_dwarn.u | set %.swt -h | if (%_dwarn.u == %_detect.sens) set %.warn UDP flood | set %.col.u3 %.col.warn } else { set %.col.u3 %.col.ok | unset %_dwarn.u3 } if ($calc(%.unreach - %_detect.n) > %.max) { inc %_dwarn.n | set %.swt -h | if (%_dwarn.n == %_detect.sens) set %.warn Nuke attack | set %.col.n %.col.warn } else { set %.col.n %.col.ok | unset %_dwarn.n } if ($calc(%.echo1 - %_detect.i1) > %.max) { inc %_dwarn.i | set %.swt -h | if (%_dwarn.i == %_detect.sens) set %.warn ICMP flood | set %.col.i1 %.col.warn } else { set %.col.i1 %.col.ok | unset %_dwarn.i } if ($calc(%.echo2 - %_detect.i2) > %.max) { set %.col.i2 %.col.warn | set %.swt -h } else set %.col.i2 %.col.ok if ($calc(%.gibs - %_detect.g) > %.max) { inc %_dwarn.g | set %.swt -h | if (%_dwarn.g == %_detect.sens) set %.warn SSPing attack | set %.col.g %.col.warn } else { set %.col.g %.col.ok | unset %_dwarn.g } rline %.swt @Attack 1 Nuke detect - %.col.n $+ %.unreach $+ unreach/error packets rline @Attack 2 ICMP detect - %.col.i1 $+ %.echo1 $+ echos received, %.col.i2 $+ %.echo2 $+ replied to rline @Attack 3 UDP detect - %.col.u1 $+ %.ns.udp1 $+ datagrams received, %.col.u2 $+ %.ns.udp4 $+ sent, %.col.u3 $+ %.udperr $+ errors rline @Attack 4 SSPing detect - %.col.g $+ %.gibs $+ fragmented packets set %_detect.n %.unreach set %_detect.i1 %.echo1 set %_detect.i2 %.echo2 set %_detect.u1 %.ns.udp1 set %_detect.u2 %.ns.udp4 set %_detect.u3 %.udperr set %_detect.g %.gibs if (%.warn != $null) { window -ar @Attack window -do +fn @Alert $_center(500,100,d) 500 100 @Close %font.quick aline @Alert %.col.warn $+ ALERT- aline %col.cdark @Alert $+ You may be under attack- aline %col.cdark @Alert $+ A possible %.warn has been detected. beep 1 1 } } ; ----------------------------------------------------- ; Nuke protection ; ----------------------------------------------------- portup { if (%_pupamt != $null) _error A PortUp is already in progress, please wait until it is finished before issuing another. if ($bits == 16) _error Sorry, the port upper will not run if you're using 16-bit mIRC. if ($1 == $null) _quickhelp /portup dispa Increasing local port by %col.target $+ $1 $+ ... set %_pupamt $1 set %.ini $_ppdir $+ m-portup.ini set %.ini2 $_ppdir $+ portup1.ini writeini %.ini2 script n2 dde $ddename command "" /_pu.loaded writeini %.ini2 aliases n7 dde $ddename command "" /_pu.done run -n mirc32 -i $+ %.ini } _pu.loaded dde PortUp command "" /portup %_pupamt $ip _pu.done { dispa Portup complete- Local port has been increased by %col.target $+ %_pupamt $+ . dispa You must reconnect to IRC to use this new local port. unset %_pupamt } ; ----------------------------------------------------- ; Repeated rejoin ; ----------------------------------------------------- repjoin { if ($1 == $null) _quickhelp /repjoin if ($1 isin -v) { if (%_repjoins == $null) dispa Not currently attempting any repeated joins. | else dispa Currently attempting repeated joins of- %col.target $+ $_s2cs(%_repjoins) | return } if ($1 isin -c) { unset %_repjoins | .timer902 off | dispa All repeated join attempts canceled. | return } set %.chan $_patch($1) if (%.chan ischan) _error You are already on $+ %.chan $+ ! if ($findtok(%_repjoins,%.chan,32)) { dispa Canceled repeated join attempt of %col.target $+ %.chan $+ . set %_repjoins $remtok(%_repjoins,%.chan,32) return } disps Repeated attempts to join %col.target $+ %.chan $+ will be made, quietly, until you are let in. set %_repjoins $addtok(%_repjoins,%.chan,32) .timer902 -o 0 20 _borkbork _borkbork } _borkbork { if (%_repjoins == $null) { .timer902 off | halt } if ($server == $null) halt .raw join $_s2c(%_repjoins) $_keys(%_repjoins) } ; ----------------------------------------------------- ; Alarms (self-made) ; ----------------------------------------------------- _d.alarm { _title ALARM window -adox @Alarm 0 0 $window(-1).w $window(-1).h @Close Arial 740 titlebar @Alarm activated aline %col.cdark @Alarm %col.att $+ ALARM activated aline @Alarm $chr(160) aline @Alarm %col.att $+ Message- beep 1 1 echo $remove(%col.cdark,-c) @Alarm $1- .timer919 -om 0 100 _chkalrm } _s.alarm splay $_p2s($1) | _d.alarm $2- _chkalrm if ($active != @Alarm) { window -c @Alarm | .timer919 off } alarm { if ($2 == $null) _quickhelp /alarm if (: isin $1) { if ($right($1,1) isin ap) { set %.hour $gettok($1,1,58) set %.minute $remove($remove($gettok($1,2,58),p),a) if (%.hour == 12) set %.hour 0 if ($right($1,1) == p) set %.hour $calc(%.hour + 12) set %.time %.hour $+ : $+ %.minute 1 1 } else set %.time $1 1 1 } elseif (s isin $1) set %.time 1 $remove($1,s) else set %.time 1 $calc($remove($1,m) * 60) set %.ext $_rtok(1,46,$2) if ((($len(%.ext) == 2) || ($len(%.ext) == 3)) && (. isin $2)) { dispa Alarm activated- Message %col.dark $+ " $+ $3- $+ ", sound %col.dark $+ $_p2s($2) _timer800 -o %.time _s.alarm $2- } else { dispa Alarm activated- Message %col.dark $+ " $+ $2- $+ " _timer800 -o %.time _d.alarm $2- } } _timer800 { set %.ttt $timer(0) if (%.ttt == 0) { timer800 $1- | dispa Message or Alarm enabled; type /timer800 off to disable. | return } :loop if ($timer(%.ttt) isnum 800-898) { timer [ $+ [ $_i($timer(%.ttt)) ] ] $1- | dispa Message or Alarm enabled; type /timer $+ $_i($timer(%.ttt)) off to disable. | return } dec %.ttt if (%.ttt > 0) goto loop timer800 $1- | dispa Message or Alarm enabled; type /timer800 off to disable. } ; ----------------------------------------------------- ; Find a user after they change ; nicknames ; ----------------------------------------------------- finduser if ($1 == $null) _quickhelp /finduser | set %-+findingu. [ $+ [ $1 ] ] $true | .raw whowas $1 | dispa Attempting to find new nickname of %col.target $+ $1 $+ (if they didn't leave IRC) _fuser2 set %.targ %-+findingu. [ $+ [ $1 ] ] | set %.targ2 %.targ $+ @ $+ $2 | set %-+findingu. [ $+ [ $1 ] ] | dispa %col.target $+ $1 $+ user info found, attempting to locate user using a /ping | set %-+findping. [ $+ [ %.targ ] ] %.targ2 | set %-+findpingn. [ $+ [ %.targ ] ] $1 | _qc %.targ2 PING 00 $+ $ticks | .timer 1 10 sping $2 ! $+ %.targ $+ ! $+ $1 ; ----------------------------------------------------- ; Botlist ; ----------------------------------------------------- botlist { if ($1 == $null) _quickhelp /botlist if ($_ischan($1)) { set %.b.chan $1 | goto botview } if (v isin $1) { :botview if ($_ischan($2)) set %.b.chan $2 | else set %.b.chan * open @Info /botlist Botlist if (%autobot.chans == $null) { dispr @Info No bots have been defined for any channels. | return } if (%.b.chan == *) set %.b.num 1 else { set %.b.num $findtok(%autobot.chans,%.b.chan,32) if (%.b.num == $null) { dispr @Info No bots have been defined for %col.target $+ %.b.chan $+ . | return } } :loop1 set %.b.ch $gettok(%autobot.chans,%.b.num,32) if (%.b.ch == $null) return set %.b.flag %autobot. [ $+ [ %.b.ch ] ] if (join isin %.b.flag) set %.b.spec (ops autorequested on join) else unset %.b.spec dispr @Info Botlist for %col.target $+ %.b.ch $+ - %.b.spec set %.b.botn 1 set %.b.pre autobot. $+ %.b.ch $+ . :loop2 set %.b.pre2 %.b.pre $+ %.b.botn set %.b.mask % [ $+ [ %.b.pre2 ] ] if (%.b.mask == $null) goto nextch set %.b.type $gettok(%.b.mask,2-,47) set %.b.serv $gettok(%.b.mask,2-,36) set %.b.mask $gettok($gettok(%.b.mask,1,47),1,36) set %.b.serv $gettok(%.b.serv,1,47) if (%.b.type != $null) set %.b.type - ( $+ %.b.type $+ ) if (%.b.serv == $null) set %.b.serv (any) dispr @Info $chr(160) Botmask %col.info1 $+ %.b.mask $+ - Server %col.info1 $+ %.b.serv $+ %.b.type set %.b.login $_ppcfg(%.b.pre2,login) set %.b.opme $_ppcfg(%.b.pre2,opme) set %.b.op $_ppcfg(%.b.pre2,op) set %.b.topic $_ppcfg(%.b.pre2,topic) set %.b.kick $_ppcfg(%.b.pre2,kick) set %.b.ban $_ppcfg(%.b.pre2,ban) set %.b.unban $_ppcfg(%.b.pre2,unban) set %.b.list $chr(160) ò if (%.b.login != $null) dispr @Info %.b.list Login command- %.b.login if (%.b.opme != $null) dispr @Info %.b.list OpMe command- %.b.opme if (%.b.op != $null) dispr @Info %.b.list Op command- %.b.op if (%.b.deop != $null) dispr @Info %.b.list Deop command- %.b.deop if (%.b.topic != $null) dispr @Info %.b.list Topic command- %.b.topic if (%.b.kick != $null) dispr @Info %.b.list Kick command- %.b.kick if (%.b.ban != $null) dispr @Info %.b.list Ban command- %.b.ban if (%.b.unban != $null) dispr @Info %.b.list Unban command- %.b.unban inc %.b.botn goto loop2 :nextch if (%.b.chan != * ) return inc %.b.num goto loop1 } if ($_ischan($2)) set %.b.chan $2 else set %.b.chan * if (%.b.chan == *) set %.b.disp %col.target $+ all channels else set %.b.disp %col.target $+ %.b.chan $+ if (a isin $1) { if (%.b.chan == *) _error You must specify a channel to add a botlist entry for. if ($4 == $null) _error You must specify the bot's mask and password. set %.b.scan 1 | unset %.b.new :loop3 set %.b.pre autobot. $+ %.b.chan $+ . $+ %.b.scan set %.b.old % [ $+ [ %.b.pre ] ] if (%.b.old == $null) { set %.b.new $true | goto found } if ($gettok($gettok(%.b.old,1,36),1,47) == $gettok($gettok($3,1,36),1,47)) goto found inc %.b.scan | goto loop3 :found dispa Botlist entry added/updated on %.b.disp for %col.info1 $+ $3 set %.b.pre autobot. $+ %.b.chan $+ . $+ %.b.scan set % [ $+ [ %.b.pre ] ] $3 _writecfg %.b.pre pw $_pwenc($4) set %autobot.chans $addtok(%autobot.chans,%.b.chan,32) if (%.b.new) { set %.b.old %autobot. [ $+ [ %.b.chan ] ] | set %autobot. [ $+ [ %.b.chan ] ] %.b.scan $gettok(%.b.old,2-,32) } } elseif (j isin $1) { if (%.b.chan == *) _error You must specify a channel to set op-on-join botlist flag for. set %.b.old %autobot. [ $+ [ %.b.chan ] ] if (%.b.old == $null) _error You must define one or more bots before you can set the op-on-join flag. if ($3 isin onyesenabled$trueop) { set %.b.set (join) | dispa When you join %.b.disp $+ , you will attempt to get ops from a bot. } else { unset %.b.set | dispa When you join %.b.disp you will not attempt to get ops using the botlist. } set %autobot. [ $+ [ %.b.chan ] ] $gettok(%.b.old,1,32) %.b.set } elseif (d isin $1) { if (%.b.chan == *) set %.b.chan %autobot.chans set %.b.gah $_numtok(32,%.b.chan) if ($3 == $null) dispa All botlist entries for %.b.disp deleted. else dispa Botlist entry %col.dark $+ $3 $+ for %.b.disp deleted. :loop4 set %.b.ch $gettok(%.b.chan,%.b.gah,32) if ($3 == $null) { set %.b.nums %autobot. [ $+ [ %.b.ch ] ] set %.b.nums $gettok(%.b.nums,1,32) :loop5 _botdel %.b.ch %.b.nums if ($_vd(.b.nums) > 0) goto loop5 } elseif ($3 isnum) _botdel %.b.ch $3 else { set %.b.nums %autobot. [ $+ [ %.b.ch ] ] set %.b.nums $gettok(%.b.nums,1,32) :loop5 set %.b.var autobot. $+ %.b.ch $+ . $+ %.b.nums set %.b.var % [ $+ [ %.b.var ] ] if ($gettok($gettok(%.b.var,1,36),1,47) == $gettok($gettok($3,1,36),1,47)) _botdel %.b.ch %.b.nums if ($_vd(.b.nums) > 0) goto loop5 } if ($_vd(.b.gah) > 0) goto loop4 } elseif (c !isin $1) _quickhelp /botlist else { if (%.b.chan == *) _error You must specify a channel to set botlist commands on if ($3 == $null) _error You must specify a botmask to set botlist commands for if ($5 == $null) _error You must specify the command to set set %.b.bit $left($4,1) if (%.b.bit == l) set %.b.cmd Login elseif (%.b.bit == t) set %.b.cmd Topic elseif (%.b.bit == k) set %.b.cmd Kick elseif (%.b.bit == b) set %.b.cmd Ban elseif (%.b.bit == u) set %.b.cmd Unban elseif (%.b.bit == d) set %.b.cmd Deop elseif ((me isin $4) || (%.b.bit == m)) set %.b.cmd OpMe elseif (%.b.bit == o) set %.b.cmd Op else _error Unknown botlist command " $+ $4 $+ " if ($3 isnum) set %.b.num $3 else { set %.b.num %autobot. [ $+ [ %.b.chan ] ] set %.b.num $gettok(%.b.num,1,32) :loop6 set %.b.var autobot. $+ %.b.chan $+ . $+ %.b.num set %.b.var % [ $+ [ %.b.var ] ] if ($gettok($gettok(%.b.var,1,36),1,47) != $gettok($gettok($3,1,36),1,47)) if ($_vd(.b.num) > 0) goto loop6 } if ((%.b.num < 1) || (%.b.num > %autobot. [ $+ [ %.b.chan ] ] )) _error Unknown bot entry " $+ $3 $+ " for channel %.b.chan set %.b.var autobot. $+ %.b.chan $+ . $+ %.b.num _writecfg %.b.var %.b.cmd $5- dispa Command %col.info1 $+ %.b.cmd $+ updated for bot. } } _botdel { set %.d.old %autobot. [ $+ [ $1 ] ] set %.d.num $gettok(%.d.old,1,32) if ($2 > %.d.num) return set %.d.var autobot. $+ $1 $+ . $+ $2 if ($2 == %.d.num) { set % [ $+ [ %.d.var ] ] _remcfg %.d.var if ($2 == 1) { set %autobot. [ $+ [ $1 ] ] set %autobot.chans $remtok(%autobot.chans,$1,32) } else set %autobot. [ $+ [ $1 ] ] $_j(%.d.num) $gettok(%.d.old,2-,32) } else { set %.d.copy autobot. $+ $1 $+ . $+ %.d.num set % [ $+ [ %.d.var ] ] % [ $+ [ %.d.copy ] ] _writecfg %.d.var pw $_ppcfg(%.d.copy,pw) _writecfg %.d.var login $_ppcfg(%.d.copy,login) _writecfg %.d.var opme $_ppcfg(%.d.copy,opme) _writecfg %.d.var op $_ppcfg(%.d.copy,op) _writecfg %.d.var deop $_ppcfg(%.d.copy,deop) _writecfg %.d.var topic $_ppcfg(%.d.copy,topic) _writecfg %.d.var kick $_ppcfg(%.d.copy,kick) _writecfg %.d.var ban $_ppcfg(%.d.copy,ban) _writecfg %.d.var unban $_ppcfg(%.d.copy,unban) set %autobot. [ $+ [ $1 ] ] $_j(%.d.num) $gettok(%.d.old,2-,32) set % [ $+ [ %.d.copy ] ] _remcfg %.d.copy } } ; ----------------------------------------------------- ; CD player ; ----------------------------------------------------- cdini { if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11 window -c @CDINI window -nl @CDINI /_finishci %font.basic _progress.1 Searching for CDPLAYER.INI... Please wait... _progress.2 0 0% complete... (drive C:) set %.fz.dr 99 | unset %.fz.found :loop1 set %.fz.wh $chr(%.fz.dr) $+ :\ inc %.fz.found $findfile(%.fz.wh,cdplayer.exe,@CDINI) if ($_vi(.fz.dr) <= 122) { set %.fz.perc $int($calc((%.fz.dr - 99) * 100 / 24)) _progress.2 %.fz.perc %.fz.perc $+ % complete... (drive $upper($chr(%.fz.dr)) $+ :) goto loop1 } set %.fz.num $line(@CDINI,0) if (%.fz.num > 0) { :loop2 rline @CDINI %.fz.num $replace($line(@CDINI,%.fz.num),.exe,.ini) if ($_vd(.fz.num) > 0) goto loop2 } window -c @Progress iline @CDINI 1 - Please double-click on the INI file you wish to use to store CD track info. - iline @CDINI 2 $chr(160) aline @CDINI $_ppdir $+ cdinfo.dat window -ar @CDINI $_center($calc( [ $window(-3).w ] - 100),165) $calc( [ $window(-3).w ] - 100) 165 halt } _finishci { set %.line $sline(@CDINI,1).ln if (%.line == < 3) halt set %cdp.inifile $remove($sline(@CDINI,1),$mircdir) disps CD track info will be stored in- %col.info2 $+ $sline(@CDINI,1) window -c @CDINI } _cdreset unset %_cdp.* %_^cdp.* | if ($_isopen(@CD)) window -n @CD cdcheck { if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11 if (?: !iswm %cdp.drive) cd d if (%cdp.inifile == $null) cd i _cdreset if (%_cc.repeats < 1) dispa Reading CD info... set %.file %cdp.drive $+ \track01.cda if ($_not($exists(%.file))) { if ($_vi(_cc.repeats) > 5) { unset %_cc.repeats if ($_isopen(@CD)) window -c @CD _error No audio CD found. If one is inserted, please retry command. Note that P&P does not support data CDs with audio tracks. } .timer920 1 2 cdcheck halt } unset %_cc.repeats run -n $_ppdir $+ do-cd.bat $ddename $_ppdir /_cdcfin %cdp.drive } _cdcfin { .timer920 off set %.file $_ppdir $+ cd-temp.txt write -il1 %.file 200 set %_cdp.serial $read -nl1 %.file if ((%_cdp.serial == $null) || (%_cdp.serial == x)) { unset %_cdp.serial | _error No audio CD found. If one is inserted, please retry command. Note that P&P does not support data CDs with audio tracks. } set %_cdp.tracks $read -nl2 %.file set %_cdp.title $_cdi.read(%_cdp.serial,title) if (%_cdp.title == $null) set %_cdp.title (unknown) set %_cdp.artist $_cdi.read(%_cdp.serial,artist) if (%_cdp.artist == $null) set %_cdp.artist (unknown) set %.num 1 :loop set %.tr $_cdi.read(%_cdp.serial,$_j(%.num)) if (%.tr == $null) set %.tr Track %.num set %_cdp.tr. [ $+ [ %.num ] ] %.tr set %_cdp.time. [ $+ [ %.num ] ] $read -nl [ $+ [ $_i($_vi(.num)) ] ] %.file set %.tmp $_j(%.num) $+ . %.tr $+ $+ %_cdp.time. [ $+ [ $_j(%.num) ] ] set %_^cdp. [ $+ [ $_j(%.num) ] ] $_a2x(%.tmp) if (%.num <= %_cdp.tracks) goto loop dispa CD: %col.info1 $+ %_cdp.title $+ by %col.info1 $+ %_cdp.artist $+ , with %col.info1 $+ %_cdp.tracks $+ tracks. %col.option $+ (ShiftF3 to edit CD info) if ($_isopen(@CD)) cdview } _cdi.read { if (.ini isin %cdp.inifile) return $readini -n $_wrapfile(%cdp.inifile) $1 $2 if ($_not($exists(%cdp.inifile))) return set %.tocdr -ns $+ $1 $+ . $+ $2 return $read %.tocdr $_wrapfile(%cdp.inifile) } _cdi.write { if (.ini isin %cdp.inifile) writeini $_wrapfile(%cdp.inifile) $1 $2 $3- else { set %.tocdr $1 $+ . $+ $2 write -s [ $+ [ %.tocdr ] ] $_wrapfile(%cdp.inifile) %.tocdr $3- } } cdplay if ($1 == $null) { dispa Running CD player... | cdtrack 1 -q } | else cdtrack $1- cddrive if ($1 == $null) _askr cddrive Enter the letter of your CD drive- | set %cdp.drive $upper($left($1,1)) $+ : | dispa Drive %col.target $+ %cdp.drive $+ will now be used as your CD drive. cdedit { if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11 if (?: !iswm %cdp.drive) cd d if (%cdp.inifile == $null) cd i if (%_cdp.serial == $null) { dispa No CD has been defined- Insert a CD and press %col.option $+ F3 to read it. | halt } if ($1 == $null) { cdview | return } set %_arhelp cdedit $1 if ($left($1,1) == t) { if ($2 == $null) { if ((%_cdp.title == $null) || ($left(%_cdp.title,1) == $chr(40))) _askr _arhelp New title for CD? else _pentry _arhelp $+ $_s2p(%_cdp.title) New title for CD? } set %_cdp.title $2- _cdi.write %_cdp.serial title $2- if ($_isopen(@CD)) rline @CD 4 CD Title: $+ %_cdp.title } elseif ($left($1,1) == a) { if ($2 == $null) { if ((%_cdp.artist == $null) || ($left(%_cdp.artist,1) == $chr(40))) _askr _arhelp New artist for CD? else _pentry _arhelp $+ $_s2p(%_cdp.artist) New artist for CD? } set %_cdp.artist $2- _cdi.write %_cdp.serial artist $2- if ($_isopen(@CD)) rline @CD 5 CD Artist: $+ %_cdp.artist } elseif (($1 !isnum) || ($1 < 1) || ($1 > %_cdp.tracks)) _error You can only edit the title, artist, or a track number. else { set %.old %_cdp.tr. [ $+ [ $1 ] ] if ($2 == $null) { if ((%.old == $null) || ($left(%.old,1) == $chr(40))) _askr _arhelp New track title for track $1 $+ ? else _pentry _arhelp $+ $_s2p(%.old) New track title for track $1 $+ ? } set %_cdp.tr. [ $+ [ $1 ] ] $2- set %_^cdp. [ $+ [ $1 ] ] $1 $+ . $2- $+ $+ ( $+ %_cdp.time. [ $+ [ $1 ] ] $+ ) _cdi.write %_cdp.serial $_j($1) $2- if ($_isopen(@CD)) rline @CD $calc(6 + $1) Track %col.target $+ $1 $+ : ( $+ %_cdp.time. [ $+ [ $1 ] ] $+ ) $+ %_cdp.tr. [ $+ [ $1 ] ] } } cdview { if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11 window -c @CD if (?: !iswm %cdp.drive) cd d if (%cdp.inifile == $null) cd i if (%_cdp.serial == $null) { dispa No CD has been defined- Insert a CD and press %col.option $+ F3 to read it. | halt } window -l $_tabscale(6,10) @CD $_winpos(14%,7%,7%,7%) @CD %font.basic titlebar @CD Info aline @CD - Double-click will $+ %cdp.click $+ track - aline @CD - Double-click here to play entire CD - aline @CD $chr(160) aline @CD CD Title: $+ %_cdp.title aline @CD CD Artist: $+ %_cdp.artist aline @CD $chr(160) set %.num 1 :loop aline @CD Track %col.target $+ %.num $+ : ( $+ %_cdp.time. [ $+ [ %.num ] ] $+ ) $+ %_cdp.tr. [ $+ [ %.num ] ] if ($_vi(.num) <= %_cdp.tracks) goto loop } cdtrack { if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11 if (?: !iswm %cdp.drive) cd d if (%cdp.inifile == $null) cd i if (%_cdp.serial == $null) { dispa No CD has been defined- Insert a CD and press %col.option $+ F3 to read it. | halt } if (($1 !isnum) || ($1 < 1) || ($1 > %_cdp.tracks)) _error You can only play tracks that exist! set %.file %cdp.drive $+ \TRACK if ($1 < 10) set %.file %.file $+ 0 set %.file %.file $+ $1 $+ .CDA run -n cdplayer -play %.file set %.tr %_cdp.tr. [ $+ [ $1 ] ] set %.time %_cdp.time. [ $+ [ $1 ] ] if ($2 == $null) { dispa Playing track %col.target $+ $1 $+ - $+ %.tr $+ - %.time | return } elseif ($2 == -q) return elseif (($_isopen($2)) || ($comchan($2,0) > 0) || ($2 isnotify)) set %.targ $2 else set %.targ $active if (($chan(%.targ) != %.targ) && ($query(%.targ) != %.targ) && ($chat($remove(%.targ,=)) != $remove(%.targ,=))) { dispa Playing track %col.target $+ $1 $+ - $+ %.tr $+ - %.time | return } set %.title %_cdp.title if (%.title == $null) set %.title (unknown) set %.artist %_cdp.artist if (%.artist == $null) set %.artist (unknown) if ($left(%_cdp.title,1) == $chr(40)) set %.msg $_getmsg(SoundMsg,CDNoTitle) elseif ($left(%_cdp.artist,1) == $chr(40)) set %.msg $_getmsg(SoundMsg,CDNoArtist) else set %.msg $_getmsg(SoundMsg,CDNormal) describe %.targ $_finalmsg($replace($replace($replace($replace($replace(%.msg,&track&,%.tr),&time&,%.time),&artist&,%.artist),&title&,%.title),&num&,$1)) } cd { if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11 set %.bit $left($1,1) if ($1 isnum) cdplay $1- elseif (%.bit isin pt) cdplay $2- elseif (%.bit == e) cdedit $2- elseif (%.bit == v) cdview elseif (%.bit == d) cddrive $2- elseif (%.bit == i) cdini else cdcheck } ; ----------------------------------------------------- ; Manually set an autoget ; command for a user ; ----------------------------------------------------- autoget { if ($1 == -c) { dispa All remembered autoget commands forgotten. | _remcfg Autoget | return } if ($2 == $null) _quickhelp /autoget set %.lvl.nick $_nickglob($1) if (($_ismask($1) == $false) && ($address(%.lvl.nick,5) == $null)) _lookup %.lvl.nick ! autoget , $2- if (* isin $1) set %.lvl.addr $1 else { if (@ !isin %.lvl.nick) set %.lvl.nick $address(%.lvl.nick,5) set %.lvl.addr $mask(%.lvl.nick,3) } if ($2 == -c) { dispa Clearing autoget command for %col.target $+ %.lvl.addr _writecfg AutoGet %.lvl.addr } else { dispa Setting autoget command for %col.target $+ %.lvl.addr $+ to %col.info1 $+ $2- _writecfg AutoGet %.lvl.addr $2- } }